import Http from '../http';

// 分页查询字典数据
export const listByLimit = function(queryWhere: any) {
    return Http.post('/sysDictData/queryLimit', queryWhere)
}

// 查询字典类型树
export const queryLaySelectTree = function(queryWhere: any) {
    return Http.post('/sysDictType/queryLaySelectTree', queryWhere)
}

// 新增字典数据
export const saveByLeader = function(entityInfo: any) {
    return Http.post('/sysDictData/save', entityInfo)
}

// 编辑字典数据
export const updateByLeader = function(entityInfo: any) {
    return Http.put('/sysDictData/update', entityInfo)
}

/**
 * 获取字典详情
 * @param dictId 字典ID
 * @returns 
 */
export const queryDetail = function(dictId: any) {
    return Http.get(`/sysDictType/queryOne/${dictId}`, {})
}

// 删除单个字典类型
export const delsByLeader = function(dictId: any) {
    return Http.delete(`/sysDictType/dels?idList=${dictId}`, {})
}

// 批量删除字典数据
export const delsByBatch = function(dictIds: any[]) {
    return Http.delete(`/sysDictData/dels?idList=${dictIds.join(',')}`, {})
}

// 新增字典类型
export const saveDictType = function(entityInfo: any) {
    return Http.post('/sysDictType/save', entityInfo)
}

// 编辑字典类型
export const updateDictType = function(entityInfo: any) {
    return Http.put('/sysDictType/update', entityInfo)
}

// 删除字典类型
export const deleteDictType = function(dictId: any) {
    return Http.delete(`/sysDictType/dels?idList=${dictId}`, {})
}

